package org.alvin.i18n.ui;

import com.github.houbb.opencc4j.util.ZhConverterUtil;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

public class CnFileToTraditional {

    public static void main(String[] args) throws IOException {
        String source = "D:\\cc_new_space\\cc_charge_frontend\\cc_charge_frontend\\src\\locale\\zh";
        String target ="D:\\cc_new_space\\cc_charge_frontend\\cc_charge_frontend\\src\\locale\\zhhk";

        File file = new File(target);
        if(!file.exists()){
            file.mkdirs();
        }
        File sourceFile = new File(source);
        for(File f : sourceFile.listFiles()){
            System.out.println(f.getName());
            String content = new String(Files.readAllBytes(Paths.get(f.getAbsolutePath())),"utf-8");
            String result = ZhConverterUtil.toTraditional(content);
            Files.write(Paths.get(file.getAbsolutePath(),f.getName()),result.getBytes("utf-8"));
        }
    }
}
